<template >
  <ContentWrap>
  <div >
    <div class="title_styles">
      <div class="title_details">
        订单详情
      </div>
<!--      <div class="reornum">-->
<!--        申请订单编号：{{orderId}}-->
<!--      </div>-->

    </div>


    <div class="userInformation">
      <div class="top_title">
        <div class="box_style"></div>
        <div class="title_font">产品信息</div>
        <p class="title_right"></p>
      </div>
      <div class="top_data">



        <div v-show="isProductNull">
          <el-empty description="暂无数据" />
        </div>

        <div v-for ="(item,index) in productList  " :key='index'>
          <el-descriptions title="" :column="2" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  产品标签
                </div>
              </template>
              {{item.productLable}}
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  图标
                </div>
              </template>

              <img :src="item.productImg" style="width: 30px;height: 30px;" class="img_style">

            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  产品名称
                </div>
              </template>
              {{item.productName}}
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  最高额度（元）
                </div>
              </template>
              <el-statistic title="" :value="item.maxAmount" value-style="font-size:14px" />
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  年利率（%）
                </div>
              </template>
              {{item.annualInterest}}
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  贷款期限（个月）
                </div>
              </template>
              {{item.loanTime}}
            </el-descriptions-item>


            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  产品类型
                </div>
              </template>

              {{item.productTypeName}}
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  产品介绍
                </div>
              </template>
              {{item.productIntroduce}}
            </el-descriptions-item>


          </el-descriptions>
        </div>

      </div>

    </div>

    <div class="userInformation" v-if="poList.length>0">
      <div class="top_title">
        <div class="box_style"></div>
        <div class="title_font">准入-产品信息</div>
        <p class="title_right"></p>
      </div>
      <div class="top_data">


        <div v-show="isProductNull">
          <el-empty description="暂无数据" />
        </div>

        <div v-for ="(item,index) in poList " :key='index'>
          <el-descriptions title="" :column="2" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  产品名称
                </div>
              </template>
              {{item.productName}}
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  图标
                </div>
              </template>

              <img :src="item.productImg" style="width: 30px;height: 30px;" class="img_style">

            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  申请方式
                </div>
              </template>
              {{item.procedures}}
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  还款方式
                </div>
              </template>
              {{item.modeOfRepayment}}
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  期限
                </div>
              </template>
              {{item.deadline}}
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  年化利率
                </div>
              </template>
              {{item.timeRate}}
            </el-descriptions-item>

            <el-descriptions-item width="24%">
              <template #label>
                <div class="cell-item">
                  额度
                </div>
              </template>
              <el-col :span="6">
                <el-statistic title="" :value="item.quotaFormula" value-style="font-size:14px" />
              </el-col>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  月供信息
                </div>
              </template>
              <el-col :span="6">
                <el-statistic title="" :value="item.monthlyInfo" value-style="font-size:14px" />
              </el-col>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  实际放款额度
                </div>
              </template>
              <el-col :span="6">
                <el-statistic title="" :value="item.practicalAmount" value-style="font-size:14px" />
              </el-col>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  收费标准
                </div>
              </template>
              <span v-if="applyState==3">
                  <el-statistic title="" :value="item.directProfit" value-style="font-size:14px" >
                    <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                  </el-statistic>
              </span>
              <span v-if="applyState<3">
                 <span v-if="item.units=='元'">
                   <el-statistic title="" :value="item.directProfit" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                   </el-statistic>
                </span>
                <span v-if="item.units!='元'">
                   <el-statistic title="" :value="item.directProfit" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">%</span>
                    </template>
                   </el-statistic>
                </span>
              </span>
            </el-descriptions-item>

          </el-descriptions>
        </div>

      </div>

    </div>


    <div class="userInformation">
      <div class="top_title">
        <div class="box_style"></div>
        <div class="title_font">提成说明</div>
        <p class="title_right"></p>
      </div>
      <div class="top_data">
        <div>
          <el-descriptions title="" :column="3" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  <el-tag type="primary">区域经理</el-tag>
                </div>
              </template>
              <span v-if="applyState==3">
                  <el-statistic title="" :value="percentage.regionalManagerRoyalty" value-style="font-size:14px" >
                    <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                  </el-statistic>
              </span>
              <span v-if="applyState<3">
                 <span v-if="percentage.deductType==0">
                   <el-statistic title="" :value="percentage.regionalManagerRoyalty" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                   </el-statistic>
                </span>
                <span v-if="percentage.deductType==1">
                   <el-statistic title="" :value="percentage.regionalManagerRoyalty" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">%</span>
                    </template>
                   </el-statistic>
                </span>
              </span>
            </el-descriptions-item>


            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  <el-tag type="primary">业务主管</el-tag>
                </div>
              </template>
              <span v-if="applyState==3">
                  <el-statistic title="" :value="percentage.businessSupervisorRoyalty" value-style="font-size:14px" >
                    <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                  </el-statistic>
              </span>
              <span v-if="applyState<3">
                 <span v-if="percentage.deductType==0">
                   <el-statistic title="" :value="percentage.businessSupervisorRoyalty" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                   </el-statistic>
                </span>
                <span v-if="percentage.deductType==1">
                   <el-statistic title="" :value="percentage.businessSupervisorRoyalty" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">%</span>
                    </template>
                   </el-statistic>
                </span>
              </span>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  <el-tag type="primary">业务经理</el-tag>
                </div>
              </template>
              <span v-if="applyState==3">
                  <el-statistic title="" :value="percentage.businessManagerRoyalty" value-style="font-size:14px" >
                    <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                  </el-statistic>
              </span>
              <span v-if="applyState<3">
                 <span v-if="percentage.deductType==0">
                   <el-statistic title="" :value="percentage.businessManagerRoyalty" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                   </el-statistic>
                </span>
                <span v-if="percentage.deductType==1">
                   <el-statistic title="" :value="percentage.businessManagerRoyalty" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">%</span>
                    </template>
                   </el-statistic>
                </span>
              </span>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  <el-tag  type="success">权证主管</el-tag>
                </div>
              </template>
              <span v-if="applyState==3">
                  <el-statistic title="" :value="percentage.warrantSupervisor" value-style="font-size:14px" >
                    <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                  </el-statistic>
              </span>
              <span v-if="applyState<3">
                 <span v-if="percentage.deductType==0">
                   <el-statistic title="" :value="percentage.warrantSupervisor" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">元</span>
                    </template>
                   </el-statistic>
                </span>
                <span v-if="percentage.deductType==1">
                   <el-statistic title="" :value="percentage.warrantSupervisor" value-style="font-size:14px" >
                       <template #suffix>
                      <span style="font-size: 14px">%</span>
                    </template>
                   </el-statistic>
                </span>
              </span>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  <el-tag  type="danger">推荐人</el-tag>
                </div>
              </template>
              <span v-if="applyState==3">
                 {{percentage.clientRoyalty}} 财富值
              </span>
              <span v-if="applyState<3">
                 {{percentage.clientRoyalty}}
                 <span v-if="percentage.deductType==0">
                  财富值
                </span>
                <span v-if="percentage.deductType==1">
                  %
                </span>
              </span>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">

                  <el-tag  type="danger">客户</el-tag>
                </div>
              </template>
              <span v-if="applyState==3">
                 {{percentage.clientRoyalty}} 财富值
              </span>
              <span v-if="applyState<3">
                 {{percentage.clientRoyalty}}
                 <span v-if="percentage.deductType==0">
                  财富值
                </span>
                <span v-if="percentage.deductType==1">
                  %
                </span>
              </span>
            </el-descriptions-item>


          </el-descriptions>
        </div>

      </div>

    </div>


    <div class="userInformation">
      <div class="top_title">
        <div class="box_style"></div>
        <div class="title_font">用户信息</div>
        <p class="title_right"></p>
      </div>
      <div class="top_data">
        <el-descriptions title="" :column="3" border>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                姓名
              </div>
            </template>
            {{userData.name}}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                性别
              </div>
            </template>
            <span v-if="userData.sex == 1">
              男
            </span>
            <span v-if="userData.sex == 2">
              女
            </span>
            <span v-if="userData.sex == 3">
              未知
            </span>
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                年龄
              </div>
            </template>
            {{userData.age}}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                户籍
              </div>
            </template>
            {{userData.censusRegister}}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                户口
              </div>
            </template>
            {{userData.registeredHk}}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                身份证号
              </div>
            </template>
            {{userData.identityCard}}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                手机号
              </div>
            </template>
            {{userData.mobile}}
          </el-descriptions-item>

        </el-descriptions>
      </div>

    </div>


    <div class="userInformation">
      <div class="top_title">
        <div class="box_style"></div>
        <div class="title_font">车辆信息</div>
        <p class="title_right"></p>
      </div>
      <div class="top_data">




        <div v-show="isCarNull">
          <el-empty description="暂无数据" />
        </div>



        <div v-for ="(item,index) in carList  ">

          <el-descriptions title="" :column="2" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  行业
                </div>
              </template>
              {{item.industry}}
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  车辆状态
                </div>
              </template>
              {{item.carState}}
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  车辆座位
                </div>
              </template>
              {{item.carNumber}}
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  车辆动力
                </div>
              </template>
              {{item.carPower}}
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  是否个人名下非运营
                </div>
              </template>
              {{item.isOperation}}
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  职务
                </div>
              </template>
              {{item.job}}
            </el-descriptions-item>


            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  全款车目前市场价
                </div>
              </template>
              <el-statistic title="" :value="item.totalPayment" value-style="font-size:14px"  />
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  按揭车剩余本金
                </div>
              </template>
              <el-statistic title="" :value="item.oddCorpus" value-style="font-size:14px"  />
            </el-descriptions-item>

          </el-descriptions>
        </div>

      </div>

    </div>


    <div class="userInformation">
      <div class="top_title">
        <div class="box_style"></div>
        <div class="title_font">补充资料</div>
        <p class="title_right"></p>
      </div>

      <div v-if="ordeList.length<=0">
        <el-empty description="暂无资料信息" />
      </div>

      <div class="top_data">
        <el-collapse>
            <el-collapse-item v-for="(item,index) in ordeList" :title="item"   :name="index">
              <el-table :data="orderCompletionTitle[item]" stripe style="width: 100%">
                <el-table-column prop="categoryName" label="类目" width="800px" />
                <el-table-column prop="resultValue" label="处理结果" width="800px" />
              </el-table>
            </el-collapse-item>
        </el-collapse>
      </div>

    </div>


    <!-- <footer>
      <el-row class="mb-4">
        <el-button type="primary" @click="infomationFrom()">完善资料</el-button>
        <el-button type="info">客户电话 {{userData.mobile}}</el-button>
      </el-row>
    </footer> -->

  </div>
    </ContentWrap>
</template>


<script lang="ts" setup>
import * as UsersApi from "@/api/hutai/salesman";
import {ref } from 'vue'
import { useRoute } from 'vue-router';

let isCarNull = false;
let isProductNull = false;
let carList= ref([

])
const route = useRoute();
const orderId = route.query.id
const applyState = ref(0)
let productList = ref([])
let userData = ref({
  id: undefined,
  name: undefined,
  sex:undefined,
  identityCard:undefined,
  age:undefined,
  mobile:undefined,
  censusRegister: undefined,
  registeredHk:undefined
})

let percentage = ref({
  businessManagerRoyalty: undefined,
  businessSupervisorRoyalty: undefined,
  clientRoyalty: undefined,
  deductType: undefined,
  directProfit: undefined,
  grossProfit: undefined,
  indirectProfit: undefined,
  platformProfit: undefined,
  referrerRoyalty: undefined,
  regionalManagerRoyalty: undefined,
  warrantOfficer: undefined,
  warrantSupervisor: undefined,
})
let poList = ref([])
let ordeList = reactive([])
let orderCompletionTitle=reactive([])

UsersApi.getZiliao(orderId).then(res=>{
  orderCompletionTitle=res
  for (var data in res){
    ordeList.push(data)
  }
})

const handleChange = (val: string[]) => {
  //console.log(val)
}
const { push } = useRouter()
let flowN = ref(null)
const infomationFrom = () => {
  push({
    path:'/salesmanHome/salesmanHomeInfo',
    query:{id:orderId,flowN:flowN.value}
  })
}

/** 查询列表 */
const getList = async () => {
  try {
    const data = await UsersApi.getOrderInfoById(orderId)
    applyState.value = data.applyState
    poList.value = data.poList
    percentage.value = data.percentage
    flowN.value = data.recordRespVO.flowN
    userData.value = data.user
    carList.value = data.carList
    productList.value = data.product
    //console.log(data.carList.length)
    if (data.product.length == 0){
      isProductNull = true;
    }
    if (data.carList.length == 0){
      isCarNull = true;
    }
    //console.log(carList);
    console.log(data)
  } finally {
  }
}



/** 初始化 **/
onMounted(() => {
  getList()
})
</script>


<style lang="scss">

.el_img{
  width: 15px;
  height: 15px;
}

.order_div1{
  position: absolute;
  display: flex;
  width: 80%;
  height: 70px;
  margin-top: 170px;
  margin-left: 20px;
  justify-content: left;

  .title_styles{
    width: 100px;
    height: 30px;
    padding-top: 30px;
    margin-top: 10px;
    border: 1px rgb(240 240 240) solid;
  }
}

.order_div{
  position: absolute;
  display: flex;
  width: 80%;
  height: 70px;
  margin-top: 20px;
  margin-left: 20px;
  justify-content: left;

  .title_styles{
    width: 100px;
    height: 30px;
    padding-top: 30px;
    margin-top: 10px;
    border-bottom: 1px solid #d9d9d9;
  }
}

.steps_style{
  flex-wrap: wrap;

  el-step{
    width: 1000px;
  }
}

.information_item_style{
  flex-wrap: wrap;
  width: 250px;
  margin-top: 10px;
}

.bottom_div{
  display: flex;
  margin-top: -120px;

  .bottom_table{

  }

  .bottom_box{
    width: 120px;
    height: 40px;
    font-size: 10px;
    text-align: center;
    border: 1px solid rgb(245 245 245);
  }
}

.title_fonts{
  font-size: 10px;
}

.insureData_style{
  display: flex;
  font-size: 10px;

  .img_style{
    width: 10px;
    height: 10px;
    margin-top: 4px;
    margin-right: 5px;
  }

  .mid_font{
    font-size: 10px;
    font-weight: 900;
    color: rgb(237 109 75);
    text-decoration: underline;
  }
}

.mid_div{
  width: 150px;
  height: 90px;
  padding-top: 10px;
  margin-top: 20px;
  margin-right: 20px;
  margin-left: 20px;
  text-align: center;

  .mid_font{
    margin-top: 10px;
    font-size: 15px;
  }

  .img_style{
    width: 40px;
    height: 40px;
  }
}

.img_style{
  width: 15px;
  height: 15px;
}

.cell-item {
  display: flex;
  color: black;
  align-items: center;
}

.margin-top {
  width: 98%;
  margin: 0 auto;
}

.el-descriptions {
  margin-top: 10px;
}

.userInformation{
  width: 96%;
  min-height: 100px;
  padding: 0 0 20px;
  margin: 0 auto;
  margin-bottom: 1.5%;
  background-color: white;
  border-radius: 4px;

  .top_title{
    //padding-top: 20px;
    display: flex;
    //justify-content: space-between;
  }

  .title_right{
    width: 200px;
    font-size: 12px;
  }

  .title_font{
    width: 80%;
    margin: 6px 10px 10px;
    font-size: 16px;
    font-weight: 500;
  }

  .box_style{
    width: 2px;
    height: 15px;
    margin: 10px 0 0 10px;
    background-color: #2d8cf0;
  }
}

.title_styles{
  display: flex;
  width: 100%;
  padding: 20px;
  margin-bottom: 2%;
  border-bottom: 1px solid #e5e7eb;
  justify-content: space-between;

  .title_details{
    width: 50%;
    padding-left: 15px;
    font-size: 14px;
    font-weight: 500;
  }

  .reornum{
    width: 50%;
    padding-right: 100px;
    font-size: 13px;
    text-align: right;
  }
}




</style>
